home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / rcmd.man < prev    next >
Encoding:
Text File  |  1990-03-28  |  4.8 KB  |  133 lines

  1.  
  2.  
  3.  
  4. RCMD                  C Library Procedures                   RCMD
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      rcmd, rresvport, ruserok - routines for returning a stream
  10.      to a remote command
  11.  
  12. SSYYNNOOPPSSIISS
  13.      rreemm == rrccmmdd((aahhoosstt,, iinnppoorrtt,, llooccuusseerr,, rreemmuusseerr,, ccmmdd,, ffdd22pp));;
  14.      cchhaarr ****aahhoosstt;;
  15.      iinntt iinnppoorrtt;;
  16.      cchhaarr **llooccuusseerr,, **rreemmuusseerr,, **ccmmdd;;
  17.      iinntt **ffdd22pp;;
  18.  
  19.      ss == rrrreessvvppoorrtt((ppoorrtt));;
  20.      iinntt **ppoorrtt;;
  21.  
  22.      rruusseerrookk((rrhhoosstt,, ssuuppeerruusseerr,, rruusseerr,, lluusseerr));;
  23.      cchhaarr **rrhhoosstt;;
  24.      iinntt ssuuppeerruusseerr;;
  25.      cchhaarr **rruusseerr,, **lluusseerr;;
  26.  
  27. DDEESSCCRRIIPPTTIIOONN
  28.      _R_c_m_d is a routine used by the super-user to execute a com-
  29.      mand on a remote machine using an authentication scheme
  30.      based on reserved port numbers.  _R_r_e_s_v_p_o_r_t is a routine
  31.      which returns a descriptor to a socket with an address in
  32.      the privileged port space.  _R_u_s_e_r_o_k is a routine used by
  33.      servers to authenticate clients requesting service with
  34.      _r_c_m_d.  All three functions are present in the same file and
  35.      are used by the _r_s_h_d(8C) server (among others).
  36.  
  37.      _R_c_m_d looks up the host *_a_h_o_s_t using _g_e_t_h_o_s_t_b_y_n_a_m_e(3N),
  38.      returning -1 if the host does not exist.  Otherwise *_a_h_o_s_t
  39.      is set to the standard name of the host and a connection is
  40.      established to a server residing at the well-known Internet
  41.      port _i_n_p_o_r_t.
  42.  
  43.      If the connection succeeds, a socket in the Internet domain
  44.      of type SOCK_STREAM is returned to the caller, and given to
  45.      the remote command as ssttddiinn and ssttddoouutt.  If _f_d_2_p is non-
  46.      zero, then an auxiliary channel to a control process will be
  47.      set up, and a descriptor for it will be placed in *_f_d_2_p.
  48.      The control process will return diagnostic output from the
  49.      command (unit 2) on this channel, and will also accept bytes
  50.      on this channel as being UNIX signal numbers, to be for-
  51.      warded to the process group of the command.  If _f_d_2_p is 0,
  52.      then the ssttddeerrrr (unit 2 of the remote command) will be made
  53.      the same as the ssttddoouutt and no provision is made for sending
  54.      arbitrary signals to the remote process, although you may be
  55.      able to get its attention by using out-of-band data.
  56.  
  57.      The protocol is described in detail in _r_s_h_d(8C).
  58.  
  59.      The _r_r_e_s_v_p_o_r_t routine is used to obtain a socket with a
  60.  
  61.  
  62.  
  63. Sprite v1.0            September 30, 1987                       1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RCMD                  C Library Procedures                   RCMD
  71.  
  72.  
  73.  
  74.      privileged address bound to it.  This socket is suitable for
  75.      use by _r_c_m_d and several other routines.  Privileged Internet
  76.      ports are those in the range 0 to 1023.  Only the super-user
  77.      is allowed to bind an address of this sort to a socket.
  78.  
  79.      _R_u_s_e_r_o_k takes a remote host's name, as returned by a
  80.      _g_e_t_h_o_s_t_b_y_a_d_d_r(3N) routine, two user names and a flag indi-
  81.      cating whether the local user's name is that of the super-
  82.      user.  It then checks the files /_e_t_c/_h_o_s_t_s._e_q_u_i_v and, possi-
  83.      bly, ._r_h_o_s_t_s in the local user's home directory to see if
  84.      the request for service is allowed.  A 0 is returned if the
  85.      machine name is listed in the ``hosts.equiv'' file, or the
  86.      host and remote user name are found in the ``.rhosts'' file;
  87.      otherwise _r_u_s_e_r_o_k returns -1.  If the _s_u_p_e_r_u_s_e_r flag is 1,
  88.      the checking of the ``hosts.equiv'' file is bypassed.  If
  89.      the local domain (as obtained from _g_e_t_h_o_s_t_n_a_m_e(2)) is the
  90.      same as the remote domain, only the machine name need be
  91.      specified.
  92.  
  93. SSEEEE AALLSSOO
  94.      rlogin(1C), rsh(1C), intro(2), rexec(3), rexecd(8C),
  95.      rlogind(8C), rshd(8C)
  96.  
  97. DDIIAAGGNNOOSSTTIICCSS
  98.      _R_c_m_d returns a valid socket descriptor on success.  It
  99.      returns -1 on error and prints a diagnostic message on the
  100.      standard error.
  101.  
  102.      _R_r_e_s_v_p_o_r_t returns a valid, bound socket descriptor on suc-
  103.      cess.  It returns -1 on error with the global value _e_r_r_n_o
  104.      set according to the reason for failure.  The error code
  105.      EAGAIN is overloaded to mean ``All network ports in use.''
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0            September 30, 1987                       2
  130.  
  131.  
  132.  
  133.